/**
 * ureport报表工具默认数据源配置
 */
package com.skivingcloud.report.congfig;

import java.sql.Connection;
import java.sql.SQLException;

import javax.sql.DataSource;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import com.bstek.ureport.definition.datasource.BuildinDatasource;

/**
 * @author hushouquan
 * ureport报表工具默认数据源配置
 */
@Component
public class ReportDefaultDataSource implements BuildinDatasource {

	//默认数据源
	@Autowired
    private DataSource dataSource;
    
	/* （非 Javadoc）
	 * @see com.bstek.ureport.definition.datasource.BuildinDatasource#name()
	 */
	@Override
	public String name() {
		return "reportDefaultDataSource";
	}

	/* （非 Javadoc）
	 * @see com.bstek.ureport.definition.datasource.BuildinDatasource#getConnection()
	 */
	@Override
	public Connection getConnection() {
		try {
			return dataSource.getConnection();
		} catch (SQLException e) {
			e.printStackTrace();
			return null;
		}
	}

}
